package com.new_blog.common;



import com.new_blog.model.Userinfo;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * Created with Intellij IDEA.
 * Description;
 * User:TQ02
 * Data:2023-12-16
 * Time:15:42
 * Text：
 */
public class SessionUtils {
    public static Userinfo getUser(HttpServletRequest req){
        HttpSession session= req.getSession();
        if(session!=null && session.getAttribute(AppVarible.SESSION_USERINFO_KEY)!=null){
            return (Userinfo) session.getAttribute(AppVarible.SESSION_USERINFO_KEY);
        }
        return null;
    }
}
